/*

Author   : chaos

FileName : friend_function.cpp

Date     : 13/08/17 19:59:42

*/
#include <iostream>
#include <cstring>
using namespace std;

class Book
{
    private:
        char name [30];
        long index;
        bool on_shelf;
        friend void insert_book(const char * ,long);

    public:
        void show_data();
};

void insert_book(const char *, long);
void Book::show_data()
{
    cout << " name : " << name;
    cout << "  index : " << index ;
    if (on_shelf == true)
        cout << " On shelf" << endl;
    else
        cout << " Not on shelf" << endl;
}
int main(int argc ,char *argv[])
{
    insert_book("The C++ Bible",1);
    return 0;
}

void insert_book(const char * name , long index)
{
    Book A_Book;

    A_Book.index = index;
    strcpy(A_Book.name ,name);
    A_Book.on_shelf = true;

    A_Book.show_data();
}
